//
// IAnimatable.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRefCount;

public class IAnimatable extends CRefCount {
  private long swigCPtr;

  public IAnimatable(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.IAnimatable_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(IAnimatable obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_IAnimatable(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public IAnimatedValue getValue(long valueId) {
    long cPtr = nel3dJNI.IAnimatable_getValue(swigCPtr, this, valueId);
    return (cPtr == 0) ? null : new IAnimatedValue(cPtr, false);
  }

  public String getValueName(long valueId) {
    return nel3dJNI.IAnimatable_getValueName(swigCPtr, this, valueId);
  }

  public ITrack getDefaultTrack(long valueId) {
    long cPtr = nel3dJNI.IAnimatable_getDefaultTrack(swigCPtr, this, valueId);
    return (cPtr == 0) ? null : new ITrack(cPtr, false);
  }

  public void registerToChannelMixer(CChannelMixer chanMixer, String prefix) {
    nel3dJNI.IAnimatable_registerToChannelMixer__SWIG_0(swigCPtr, this, CChannelMixer.getCPtr(chanMixer), chanMixer, prefix);
  }

  public void registerToChannelMixer(CChannelMixer chanMixer) {
    nel3dJNI.IAnimatable_registerToChannelMixer__SWIG_1(swigCPtr, this, CChannelMixer.getCPtr(chanMixer), chanMixer);
  }

  public void setFather(IAnimatable father, long fatherOwnerBit) {
    nel3dJNI.IAnimatable_setFather(swigCPtr, this, IAnimatable.getCPtr(father), father, fatherOwnerBit);
  }

  public void touch(long valueId, long ownerValueId) {
    nel3dJNI.IAnimatable_touch(swigCPtr, this, valueId, ownerValueId);
  }

  public long isTouched(long valueId) {
    return nel3dJNI.IAnimatable_isTouched(swigCPtr, this, valueId);
  }

  public void resize(long count) {
    nel3dJNI.IAnimatable_resize(swigCPtr, this, count);
  }

  public final static class TAnimValues {
    public final static TAnimValues AnimValueLast = new TAnimValues("AnimValueLast", nel3dJNI.IAnimatable_AnimValueLast_get());

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TAnimValues swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TAnimValues.class + " with value " + swigValue);
    }

    private TAnimValues(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TAnimValues(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TAnimValues(String swigName, TAnimValues swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TAnimValues[] swigValues = { AnimValueLast };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
